package plus.easydo.easypush.redis;

import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.connection.stream.Record;
import org.springframework.data.redis.stream.StreamListener;
import org.springframework.stereotype.Component;
import plus.easydo.starter.redis.stream.RedisStreamListener;

/**
 * @author laoyu
 * @version 1.0
 * @date 2022/2/22
 */
@Component
@RedisStreamListener(topic = "topic2",group = "public")
public class Topic1RedisStreamListener implements StreamListener<String,Record<String,String>> {

    private static final Logger logger = LoggerFactory.getLogger(Topic1RedisStreamListener.class);

    @Override
    public void onMessage(Record message) {

        logger.info("Topic1RedisStreamListener: id:{}", message.getId());
        logger.info("Topic1RedisStreamListener: stream:{}", message.getStream());
        logger.info("Topic1RedisStreamListener: vaue:{}", message.getValue());
    }
}
